public class moveZeroes {
    public void moveZeroes(int[] nums) {
        //使用双指针，将非零元素前移，零元素设置
        int slow = 0;
        for(int fast = 0; fast < nums.length; fast++){
            if(nums[fast] != 0){
                nums[slow] = nums[fast];
                slow++;
            }
        }
        while(slow < nums.length){
            nums[slow] = 0;
            slow++;
        }
        return;
    }
}
